<div class="contentBody">
<p class="searchbar">
<span style="float: left;"><a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Forumsmyposts.Search&amp;search_id=userposts">View topics with my posts</a> | <a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Forums.Search&amp;search_id=active_topics">View active topics</a></span>
<span style="float: right;"><a href="<TMPL_VAR NAME=CGI_BASE_URL>s=User.Memberlist">Members</a> | <a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Forums.FAQ">FAQ</a> | <a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Forums.Search">Search</a></span>
</p>
<br />	
	<table class="tablebg" width="100%" cellspacing="0" cellpadding="0" style="margin-top: 5px;">
	<tr>
		<td class="row1">
		<p class="breadcrumbs"><a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Forums">Board index</a> &#187; <a href="<TMPL_VAR NAME=CGI_BASE_URL>s=Privatemessage.Edit&amp;to=<TMPL_VAR NAME=TO_PK_OBJECT_ID>">Private Message</a></p>
		<p class="datetime">All times are <TMPL_VAR NAME=USER_USER_TIMEZONE_STR> </p>
		</td>

	</tr>
	</table>
	<br />	
	<div class="pageheader">
		<h2><a class="titles" href="<TMPL_VAR NAME=CGI_BASE_URL>s=Privatemessage&amp;o=<TMPL_VAR NAME=PK_OBJECT_ID>"><TMPL_VAR NAME=PRIVATEMESSAGE_TITLE></a></h2>
			</div>

	<br/>


<TMPL_VAR NAME=PRIVATEMESSAGE_PREVIEW>

<TMPL_VAR NAME=_OBJECT_UPDATE_ERROR_>

<script language="javascript" type="text/javascript">
<!--
// bbCode control by
// subBlue design
// www.subBlue.com
// mods by mdr

// Startup variables
var imageTag = false;
var theSelection = false;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

// Helpline messages
b_help = "Bold text: [b]text[/b]  (alt+b)";
i_help = "Italic text: [i]text[/i]  (alt+i)";
u_help = "Underline text: [u]text[/u]  (alt+u)";
q_help = "Quote text: [quote]text[/quote]  (alt+q)";
c_help = "Code display: [code]code[/code]  (alt+c)";
l_help = "List: [list]text[/list] (alt+l)";
o_help = "Ordered list: [list=]text[/list]  (alt+o)";
p_help = "Insert image: [img]http://image_url[/img]  (alt+p)";
w_help = "Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]  (alt+w)";
a_help = "Close all open bbCode tags";
s_help = "Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000";
f_help = "Font size: [size=x-small]small text[/size]";

// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]');
imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
    document.forms[0].helpbox.value = eval(help + "_help");
}


// Replacement for arrayname.length property
function getarraysize(thearray) {
    for (i = 0; i < thearray.length; i++) {
        if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
            return i;
        }
    return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
    thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
    thearraysize = getarraysize(thearray);
    retval = thearray[thearraysize - 1];
    delete thearray[thearraysize - 1];
    return retval;
}


function checkForm() {

    formErrors = false;

    if (document.forms[0].PRIVATEMESSAGE_BODY.value.length < 2) {
        formErrors = "You must enter a message when posting.";
    }

    if (formErrors) {
        alert(formErrors);
        return false;
    } else {
        bbstyle(-1);
        //formObj.preview.disabled = true;
        //formObj.submit.disabled = true;
        return true;
    }
}


function bbfontstyle(bbopen, bbclose) {
    var txtarea = document.forms[0].PRIVATEMESSAGE_BODY;

    if ((clientVer >= 4) && is_ie && is_win) {
        theSelection = document.selection.createRange().text;
        if (!theSelection) {
            txtarea.value += bbopen + bbclose;
            txtarea.focus();
            return;
        }
        document.selection.createRange().text = bbopen + theSelection + bbclose;
        txtarea.focus();
        return;
    }
    else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
    {
        mozWrap(txtarea, bbopen, bbclose);
        return;
    }
    else
    {
        txtarea.value += bbopen + bbclose;
        txtarea.focus();
    }
    storeCaret(txtarea);
}


function bbstyle(bbnumber) {
    var txtarea = document.forms[0].PRIVATEMESSAGE_BODY;

    donotinsert = false;
    theSelection = false;
    bblast = 0;

    if (bbnumber == -1) { // Close all open tags & default button names
        while (bbcode[0]) {
            butnumber = arraypop(bbcode) - 1;
            txtarea.value += bbtags[butnumber + 1];
            buttext = eval('document.forms[0].addbbcode' + butnumber + '.value');
            eval('document.forms[0].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
        }
        imageTag = false; // All tags are closed including image tags :D
        txtarea.focus();
        return;
    }

    if ((clientVer >= 4) && is_ie && is_win)
    {
        theSelection = document.selection.createRange().text; // Get text selection
        if (theSelection) {
            // Add tags around selection
            document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
            txtarea.focus();
            theSelection = '';
            return;
        }
    }
    else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
    {
        mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
        return;
    }

    // Find last occurance of an open tag the same as the one just clicked
    for (i = 0; i < bbcode.length; i++) {
        if (bbcode[i] == bbnumber+1) {
            bblast = i;
            donotinsert = true;
        }
    }

    if (donotinsert) {      // Close all open tags up to the one just clicked & default button names
        while (bbcode[bblast]) {
                butnumber = arraypop(bbcode) - 1;
                txtarea.value += bbtags[butnumber + 1];
                buttext = eval('document.forms[0].addbbcode' + butnumber + '.value');
                eval('document.forms[0].addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
                imageTag = false;
            }
            txtarea.focus();
            return;
    } else { // Open tags

        if (imageTag && (bbnumber != 14)) {     // Close image tag before adding another
            txtarea.value += bbtags[15];
            lastValue = arraypop(bbcode) - 1;   // Remove the close image tag from the list
            document.forms[0].addbbcode14.value = "Img";    // Return button back to normal state
            imageTag = false;
        }

        // Open tag
        txtarea.value += bbtags[bbnumber];
        if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
        arraypush(bbcode,bbnumber+1);
        eval('document.forms[0].addbbcode'+bbnumber+'.value += "*"');
        txtarea.focus();
        return;
    }
    storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
    var selLength = txtarea.textLength;
    var selStart = txtarea.selectionStart;
    var selEnd = txtarea.selectionEnd;
    if (selEnd == 1 || selEnd == 2)
        selEnd = selLength;

    var s1 = (txtarea.value).substring(0,selStart);
    var s2 = (txtarea.value).substring(selStart, selEnd)
    var s3 = (txtarea.value).substring(selEnd, selLength);
    txtarea.value = s1 + open + s2 + close + s3;
    return;
}

// SBR: This is evil
// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
//function storeCaret(textEl) {
//  if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
//}

//-->
</script>

<fieldset>
<table width="100%"	class="contentTable">
<tr>
<td class="label">To:</th>
<td><select name="FK_TO_ID"><TMPL_VAR NAME=PRIVATEMESSAGE_USER_OPTIONS></select><br />
<a href="<TMPL_VAR NAME=CGI_BASE_URL>s=User&amp;o=<TMPL_VAR NAME=TO_PK_OBJECT_ID>"><TMPL_VAR NAME=TO_USER_NAME></a><br />
<small>Select the recipient from the list above</small>
<input type="hidden" name="PRIVATEMESSAGE_DELIVERED" value="<TMPL_VAR NAME=PRIVATEMESSAGE_DELIVERED>">
<br></td>
</tr>
<tr>
<td class="label">Subject:</th>
<td><input type="text" name="PRIVATEMESSAGE_TITLE" value="<TMPL_VAR NAME=PRIVATEMESSAGE_TITLE>" size="55"  style="width: 500px;">
<br><TMPL_VAR NAME=_OBJECT_UPDATE_ERROR_PRIVATEMESSAGE_TITLE_></td>
</tr>
<tr>
<td class="label" style="border-bottom: 0px;">Message:</td>
<td class="label" style="border-bottom: 0px;">
    <table border="0" cellspacing="0" cellpadding="0">
    <tr align="center">
    <td>
    <input type="button"  accesskey="b" name="addbbcode0" value=" B " style="font-weight:bold; font-size: 8pt;" onclick="bbstyle(0)" onmouseover="helpline('b')" class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="i" name="addbbcode2" value=" i " style="font-style:italic; font-size: 8pt;" onclick="bbstyle(2)" onmouseover="helpline('i')"  class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="u" name="addbbcode4" value=" u " style="text-decoration: underline; font-size: 8pt;" onclick="bbstyle(4)" onmouseover="helpline('u')"  class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="q" name="addbbcode6" value="Quote" style="font-size: 8pt;" onclick="bbstyle(6)" onmouseover="helpline('q')" class="button" />
    </td>
    <td>
    <input type="button"  accesskey="c" name="addbbcode8" value="Code" style="font-size: 8pt;" onclick="bbstyle(8)" onmouseover="helpline('c')"  class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="l" name="addbbcode10" value="List" style="font-size: 8pt;" onclick="bbstyle(10)" onmouseover="helpline('l')" class="button" />
    </td>
    <td>
    <input type="button"  accesskey="o" name="addbbcode12" value="List=" style="font-size: 8pt;" onclick="bbstyle(12)" onmouseover="helpline('o')"  class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="p" name="addbbcode14" value="Img" style="font-size: 8pt;"  onclick="bbstyle(14)" onmouseover="helpline('p')"  class="button"/>
    </td>
    <td>
    <input type="button"  accesskey="w" name="addbbcode16" value="URL" style="width: 40px; font-size: 8pt;" onclick="bbstyle(16)" onmouseover="helpline('w')"  class="button"/>
    </td>
	</tr>
	<tr>
     <td nowrap="nowrap" colspan=8><span style="font-size: 8pt;">&nbsp;Font colour:
        <select name="addbbcode18" class="dataentry" onchange="bbfontstyle('[color=' + this.form.addbbcode18.options[this.form.addbbcode18.selectedIndex].value + ']', '[/color]');this.selectedIndex=0;" onmouseover="helpline('s')">
        <option value="#000000">Default</option>
        <option style="color:darkred; background-color:transparent" value="darkred">Dark Red</option>
        <option style="color:red; background-color:transparent" value="red">Red</option>
        <option style="color:orange; background-color:transparent" value="orange">Orange</option>
        <option style="color:brown; background-color:transparent" value="brown">Brown</option>
        <option style="color:yellow; background-color:transparent" value="yellow">Yellow</option>
        <option style="color:green; background-color:transparent" value="green">Green</option>
        <option style="color:olive; background-color:transparent" value="olive">Olive</option>
        <option style="color:cyan; background-color:transparent" value="cyan">Cyan</option>
        <option style="color:blue; background-color:transparent" value="blue">Blue</option>
        <option style="color:darkblue; background-color:transparent" value="darkblue">Dark Blue</option>
        <option style="color:indigo; background-color:transparent" value="indigo">Indigo</option>
        <option style="color:violet; background-color:transparent" value="violet">Violet</option>
        <option style="color:white; background-color:transparent" value="white">White</option>
        <option style="color:black; background-color:transparent" value="black">Black</option>
        </select>
        &nbsp;Font size:
        <select name="addbbcode20" class="dataentry" onchange="bbfontstyle('[size=' + this.form.addbbcode20.options[this.form.addbbcode20.selectedIndex].value + ']', '[/size]')" onmouseover="helpline('f')">
        <option value="7">Tiny</option>
        <option value="9">Small</option>
        <option value="12" selected="selected">Normal</option>
        <option value="18">Large</option>
        <option  value="24">Huge</option>
        
        </select>
        </span>
        </td>
        <td nowrap="nowrap" align="right"><span style="font-size: 8pt;"><a href="javascript:bbstyle(-1)" onmouseover="helpline('a')">[close tags]</a>&nbsp;</a></td>
    </tr>
    </table>

</td>
</tr>
<tr>
    <td valign="center" style="border-top: 0px; text-align: center; vertical-align: center;"><b style="font-size: 8pt;">Emoticons</b><br>
    <TMPL_VAR NAME=PRIVATEMESSAGE_EMOTICONS_3_15>
    <a href="javascript:emoticons();">more...</a>
    <!-- emoticons go in here -->
</td>
<td style="border-top: 0px;">
<textarea rows="10" cols="100" name="PRIVATEMESSAGE_BODY" style="width: 500px;"><TMPL_VAR NAME=PRIVATEMESSAGE_BODY></textarea>
<br><TMPL_VAR NAME=_OBJECT_UPDATE_ERROR_PRIVATEMESSAGE_BODY_></td>
</tr>
</table>
<div class="submit"><input type=button class="button" onClick="if(checkForm()) previewObject('Privatemessage','<TMPL_VAR NAME=o>');" value="Preview" >
<input type=button class="submit" onClick="if(checkForm()) updateObject('Privatemessage','<TMPL_VAR NAME=o>');" value="Submit &raquo;" ></div>

</fieldset>

</div>

<TMPL_VAR NAME=OBJECT_MODERATOR_HTML>

<TMPL_VAR NAME=OBJECT_ADMIN_HTML>

<TMPL_VAR NAME=OBJECT_SUPERADMIN_HTML>

<p>
<TMPL_VAR NAME=OBJECTS> 